import type { RouteRecordRaw } from 'vue-router'

function Layout() {
  return import('@/layouts/index.vue')
}

const routes: RouteRecordRaw = {
  path: '/voucher',
  component: Layout,
  redirect: '/voucher/index',
  name: 'voucher',
  meta: {
    title: '代金券',
    icon: 'ri:coupon-2-line',
  },
  children: [
    {
      path: 'index',
      name: 'voucherIndex',
      component: () => import('@/views/Voucher/index.vue'),
      meta: {
        title: '代金券',
        menu: false,
        activeMenu: '/voucher',
      },
    },
    {
      path: 'detail',
      name: 'voucherDetail',
      component: () => import('@/views/Voucher/detail.vue'),
      meta: {
        title: '代金券表单',
        auth: ['permission.browse'],
        menu: false,
        activeMenu: '/voucher',
      },
    },
    {
      path: 'operate',
      name: 'voucherOperate',
      component: () => import('@/views/Voucher/operate.vue'),
      meta: {
        title: '券包',
        auth: ['permission.browse'],
        menu: false,
        activeMenu: '/voucher',
      },
    },
    {
      path: 'sendcoupon',
      name: 'voucherSendcoupon',
      component: () => import('@/views/Voucher/sendcoupon.vue'),
      meta: {
        title: '发送',
        auth: ['permission.browse'],
        menu: false,
        activeMenu: '/voucher',
      },
    },
    {
      path: 'products',
      name: 'voucherProducts',
      component: () => import('@/views/Voucher/products.vue'),
      meta: {
        title: '关联产品',
        auth: ['permission.browse'],
        menu: false,
        activeMenu: '/voucher',
      },
    },
  ],
}

export default routes
